﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Scytale
{
    class Camera : Element
    {
        Element element_pursued;

        public void LookAt(Element e) {
            if (e != this) {
                element_pursued = e;
            }
        }

        override public void Update() {
            if (element_pursued != null) {
                Vector3 pos = element_pursued.GetPosition() - 10 * element_pursued.GetForwardVec() + 3 * element_pursued.GetUpVec(); 
                Matrix lookat = Matrix.CreateLookAt(pos, element_pursued.GetPosition(), Vector3.Up);
                worldMatrix = lookat;
            }
        }
    }
}
